package com.googlecode.jwsm.security.caching;

public class CachedObject {
	private Object object;
	private long timeout;
	private long expiration;
	
	public CachedObject(Object object, long timeout) {
		this.timeout = timeout;
		set(object);
	}

	public boolean isExpired() {
		return System.currentTimeMillis() > expiration;
	}

	public void set(Object object) {
		this.object = object;
		expiration = System.currentTimeMillis() + timeout;
	}

	public Object get() {
		return object;
	}
}
